<template>
  <ContentWrap>
    <el-descriptions :column="2" border label-width="160">
      <el-descriptions-item label="项目编号">
        {{ detailData.projectNumber }}
      </el-descriptions-item>
      <el-descriptions-item label="公司名称">
        {{ detailData.companyName }}
      </el-descriptions-item>
      <el-descriptions-item label="项目类型">
        <el-checkbox-group v-model="projectTypeArray">
            <el-checkbox
                    v-for="dict in getIntDictOptions(DICT_TYPE.OA_PROJECT_TYPE)"
                    :key="dict.value"
                    :label="dict.value"
                    :value="dict.value"
                    disabled
            >
              {{ dict.label }}
            </el-checkbox>
        </el-checkbox-group>
      </el-descriptions-item>
      <el-descriptions-item label="注册园区及平台">
        {{ detailData.registeredParkPlatform }}
      </el-descriptions-item>
      <el-descriptions-item label="是否计算项目数">
        <dict-tag :type="DICT_TYPE.OA_IS_OR_NO" :value="detailData.isCountedProject" />
      </el-descriptions-item>
      <el-descriptions-item label="法定代表人">
        {{ detailData.legalPerson }}
      </el-descriptions-item>
      <!-- <el-descriptions-item label="是否为简化企业">
        <dict-tag :type="DICT_TYPE.OA_IS_OR_NO" :value="detailData.isSimplifiedEnterprise" />
      </el-descriptions-item> -->
      <el-descriptions-item label="是否为重点企业">
        <dict-tag :type="DICT_TYPE.OA_IS_OR_NO" :value="detailData.isKeyEnterprise" />
      </el-descriptions-item>
      <el-descriptions-item label="法人手机号码">
        {{ detailData.legalPersonPhone }}
      </el-descriptions-item>
      <el-descriptions-item label="纳税人属性">
        <dict-tag :type="DICT_TYPE.OA_TAXPAYER_ATTRIBUTE" :value="detailData.taxpayerAttribute" />
      </el-descriptions-item>
      <el-descriptions-item label="企业联系人">
        {{ detailData.enterpriseContact }}
      </el-descriptions-item>
      <el-descriptions-item label="税收情况">
        {{ detailData.taxSituation }}
      </el-descriptions-item>
      <el-descriptions-item label="企业电话">
        {{ detailData.enterpriseContactPhone }}
      </el-descriptions-item>
      <el-descriptions-item label="招商负责人">
        {{ detailData.investmentPromotionOfficer }}
      </el-descriptions-item>
      <el-descriptions-item label="项目确认人">
        {{ detailData.registrantName }}
      </el-descriptions-item>
      <el-descriptions-item label="介绍人或下级平台">
        {{ detailData.introducerOrSubPlatform }}
      </el-descriptions-item> 
      <el-descriptions-item label="记账收费价格/月">
        {{ detailData.serviceFee }}
      </el-descriptions-item>
     
      <el-descriptions-item label="返税比例">
        {{ detailData.taxRefundRatio }}
      </el-descriptions-item>
      
      <el-descriptions-item label="审批结果">
        <dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS" :value="detailData.status" />
      </el-descriptions-item>
      <el-descriptions-item  :span="2" label="项目状态">
        <dict-tag :type="DICT_TYPE.OA_PROJECT_STATUS" :value="detailData.projectStatus" />
      </el-descriptions-item>
      <el-descriptions-item :span="2" label="项目引进情况说明">
        {{ detailData.remark }}
      </el-descriptions-item>
    </el-descriptions>
  </ContentWrap>
</template>
<script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { formatDate } from '@/utils/formatTime'
import { propTypes } from '@/utils/propTypes'
import { ProjectManagementApi, ProjectManagementVO } from '@/api/oa/projectmanagement'

defineOptions({ name: 'OaProjectManagementDetail' })

const { query } = useRoute() // 查询参数

const props = defineProps({
  id: propTypes.number.def(undefined)
})
const detailLoading = ref(false) // 表单的加载中
const detailData = ref<any>({}) // 详情数据
const projectTypeArray = ref<number[]>([]) // 项目类型数组
const queryId = query.id as unknown as number // 从 URL 传递过来的 id 编号

/** 获得数据 */
const getInfo = async () => {
  detailLoading.value = true
  try {
    detailData.value = await ProjectManagementApi.getProjectManagement(props.id || queryId)
    // 将逗号分隔的字符串转换为数组，并确保转换为数字类型
    if (detailData.value.projectType) {
      projectTypeArray.value = detailData.value.projectType.split(',').map(item => Number(item))
    }
  } finally {
    detailLoading.value = false
  }
}
defineExpose({ open: getInfo }) // 提供 open 方法，用于打开弹窗

/** 初始化 **/
onMounted(() => {
  getInfo()
})
</script>
